﻿using System.Windows.Forms;

namespace AutoRevit.Tool;

/// <summary>
/// 鼠标右键执行完成
/// </summary>
public sealed class MouseRightClickFinish : IDisposable
{
    private readonly HookSelectionOperation hookSelectionOperation;

    /// <summary>
    /// 
    /// </summary>
    public MouseRightClickFinish(bool isStart = true)
    {
        hookSelectionOperation = new HookSelectionOperation()
            .AddMouseHandler((s, e) => e.Button == MouseButtons.Right, false);

        if (isStart)
            Start();
    }

    /// <summary>
    /// 启动
    /// </summary>
    public void Start()
    {
        hookSelectionOperation.Start();
    }

    /// <summary>
    /// 关闭
    /// </summary>
    public void Close()
    {
        hookSelectionOperation.Close();
    }

    /// <inheritdoc/>
    public void Dispose()
    {
        hookSelectionOperation.Dispose();
    }
}
